import React from 'react'
import { Card, Row, Button, Table,Breadcrumb} from 'antd';
import {Link} from 'react-router-dom'
import '../../assets/style/youhuilist.css'

const columns = [
  {
    title: '优惠券ID',
    dataIndex: 'id',
    width: 150,
  },
  {
    title: '优惠券名称',
    dataIndex: 'name',
    width: 150,
  },
  {
    title: '面额(元)',
    dataIndex: 'price',
    width:150
  },
  {
    title: '开始时间',
    dataIndex: 'btime',
    width: 150,
  },
  {
    title: '结束时间',
    dataIndex: 'etime',
    width: 150,
  },
  {
    title: '创建时间',
    dataIndex: 'ctime',
    width: 150,
  },
  {
    title: '创建人',
    dataIndex: 'cperson',
    width: 150,
  },
  {
    title: '操作',
    dataIndex: 'Action',
    width: 150,
    render: () => <Button danger>刪除</Button>
  }
];

const data = [];
for (let i = 0; i < 100; i++) {
  data.push({
    key: i,
    id: `${i}`,
    name: `优惠券${i}`,
    price: `${i}元`,
    btime:`2020-10-11`,
    etime:`2020-11-11`,
    ctime:`2020-10-11`,
    cperson:`jason`,
  });
}

class youhuilist extends React.Component {
  render() {
    return(
      <div>
        <Breadcrumb style={{ margin: '16px 0' }}>
          <Breadcrumb.Item>Home</Breadcrumb.Item>
          <Breadcrumb.Item>优惠券管理</Breadcrumb.Item>
        </Breadcrumb>
          <Card title='优惠券列表'>
            <Row span={24}>
              <Link to='addyouhui'>
                <Button type="primary" className={'btnbtn'} >添加优惠券</Button>
              </Link>
            </Row>
            <Row>
              <Table columns={columns} dataSource={data} pagination={{ pageSize: 50 }} scroll={{ y: 240 }} />
            </Row>
          </Card>
        </div>
    )
  }
}

export {youhuilist as default}